fix: slow start config add min_weight_percent field to avoid too big edf deadline #19712
Conversation
|
Hi @jiangshantao-dbg, welcome and thank you for your contribution. We will try to review your Pull Request as quickly as possible. In the meantime, please take a look at the contribution guidelines if you have not done so already. |
|
CC @envoyproxy/api-shepherds: Your approval is needed for changes made to |
d99d9be to
eb5a7e5
Compare
adisuissa
left a comment
There was a problem hiding this comment.
/lgtm api
Looked briefly at the code, and left a comment.
Consider adding tests for the minimal (0.0) and maximal (100.0) values.
/wait
There was a problem hiding this comment.
Technically this will be checked by the PGV validator (you added a constraint to the field that automatically checks that). Also this doesn't take into account equals on both ends.
Better to remove the checks and let PGV validate that.
There was a problem hiding this comment.
what if remove the PGV validator for this field, just use the constructor to init the value. It will throw an exception if the PGV failed, which cause the cluster can't be adding to manager. I think the min_weight_percent should not affect the cluster update, so just the warning message and use the default value 0.1 is enough ?
Also the min_weight_percent can't be 0 which will cause a really big edf deadline, and we want use the default value if the user not specify a value. so the constraint in proto use gte: 0.0(pb default value 0.0) and the constructor use > 0.0.
There was a problem hiding this comment.
PGV is meant to detect problems early and reject configs that are incorrect, so I encourage using that.
If min_weight_percent must be greater than 0.0, why not use gt instead of gte? Same goes for the upper bound (see here for more info)
There was a problem hiding this comment.
sorry, these days i am in a vacation. i will use {lt: 1.0 gt: 0.0 ignore_empty: true} to the field min_weight_percent, which allows users has not to specify the default value. and will keep checking logic in constructor to ensure the default value to 0.1.
There was a problem hiding this comment.
Note that if PGV rejects the config (due to wrong value), this code will never be reached.
|
Please let me know what you think about changing the PGV constraint (using |
…edf deadline Signed-off-by: jiangshantao <jiangshantao-dbg@qq.com>
Signed-off-by: jiangshantao <jiangshantao-dbg@qq.com>
Signed-off-by: jiangshantao <jiangshantao-dbg@qq.com>
Signed-off-by: jiangshantao <jiangshantao-dbg@qq.com>
Signed-off-by: jiangshantao <jiangshantao-dbg@qq.com>
Signed-off-by: jiangshantao <jiangshantao-dbg@qq.com>
Signed-off-by: jiangshantao <jiangshantao-dbg@qq.com>
Signed-off-by: jiangshantao <jiangshantao-dbg@qq.com>
Signed-off-by: jiangshantao <jiangshantao-dbg@qq.com>
Signed-off-by: jiangshantao <jiangshantao-dbg@qq.com>
532a2d2 to
929bd47
Compare
Signed-off-by: jiangshantao <jiangshantao-dbg@qq.com>
|
/retest |
|
Retrying Azure Pipelines: |
@adisuissa sorry, i rebase the branch which cause the reviewing processing reset. i have completed the changes, and all test cases are ok. please have a look. |
adisuissa
left a comment
There was a problem hiding this comment.
Thanks for the update.
Looked again at the API style guide, and left a comment to what I think should be changed here.
/wait
| // Configures the minimum percentage of origin weight that avoids too small new weight, | ||
| // which may cause endpoints in slow start mode receive no traffic in slow start window. | ||
| // Range between (0.0, 1.0). If not specified, the default is 0.1. | ||
| double min_weight_percent = 3 [(validate.rules).double = {lt: 1.0 gt: 0.0 ignore_empty: true}]; |
There was a problem hiding this comment.
The type should be changed to Percent (see api style).
Also note that this implies that the range should be (0, 100).
There was a problem hiding this comment.
Another option is to use a double wrapper (as the default value isn't 0), and then use PROTOBUF_GET_WRAPPED_OR_DEFAULT to set the value in the c'tor.
| min_weight_percent_ = 0.1; | ||
| if (slow_start_config.has_value()) { | ||
| if (slow_start_config.value().min_weight_percent() > 0.0 && | ||
| slow_start_config.value().min_weight_percent() < 1.0) { | ||
| min_weight_percent_ = slow_start_config.value().min_weight_percent(); | ||
| } else { | ||
| ENVOY_LOG(warn, | ||
| "Invalid value {} provided for min_weight_percent parameter, must be in range " | ||
| "(0.0, 1.0), so use default value 0.1", | ||
| slow_start_config.value().min_weight_percent()); | ||
| } | ||
| } |
There was a problem hiding this comment.
Once the field is of type Percent, you can initialize the min_weight_percent_ field in the MIL, and use PROTOBUF_PERCENT_TO_ROUNDED_INTEGER_OR_DEFAULT
Something similar to:
PROTOBUF_PERCENT_TO_DOUBLE_OR_DEFAULT(
slow_start_config, min_weight_percent, 10))/100.0
There was a problem hiding this comment.
thanks for advice. i have change to use Percent. please have a look.
Thank for you advise. i has fix code/docs as the comments suggests. please have a look. @tonya11en |
|
/retest |
|
Retrying Azure Pipelines: |
|
/wait |
@rojkov conflict resolved |
|
Sorry, you might need to merge the main branch again as it had been broken for some time. |
…t-too-big-edf-dealine Signed-off-by: jiangshantao <jiangshantao-dbg@qq.com>
@rojkov done |
|
@tonya11en could you reinstate your approval? |
|
@adisuissa could you review this pr again. there is 1 workflow awaiting approval. thanks |
adisuissa
left a comment
There was a problem hiding this comment.
Thanks!
/lgtm api
Left a couple of nits, but otherwise LGTM.
| return std::chrono::time_point_cast<std::chrono::milliseconds>(edf_lb.latest_host_added_time_) | ||
| .time_since_epoch(); | ||
| } | ||
| static double slowStartMinWeightPercent(EdfLoadBalancerBase& edf_lb) { |
There was a problem hiding this comment.
nit:
| static double slowStartMinWeightPercent(EdfLoadBalancerBase& edf_lb) { | |
| static double slowStartMinWeightPercent(const EdfLoadBalancerBase& edf_lb) { |
| const absl::optional<Runtime::Double> aggression_runtime_; | ||
| TimeSource& time_source_; | ||
| MonotonicTime latest_host_added_time_; | ||
| double slow_start_min_weight_percent_; |
Signed-off-by: jiangshantao <jiangshantao-dbg@qq.com>
|
/retest |
|
Retrying Azure Pipelines: |
|
/assign-from @envoyproxy/senior-maintainers |
|
@envoyproxy/senior-maintainers assignee is @yanavlasov |
…edf deadline (envoyproxy#19712) * fix: slow start config add min_weight_percent field to avoid too big edf deadline Signed-off-by: jiangshantao <jiangshantao-dbg@qq.com>
* fix: slow start config add min_weight_percent field to avoid too big edf deadline (envoyproxy#19712) * fix: slow start config add min_weight_percent field to avoid too big edf deadline Signed-off-by: jiangshantao <jiangshantao-dbg@qq.com> * fix: ./tools/proto_format/proto_format.sh fix generate proto Signed-off-by: jiangshantao <jiangshantao-dbg@qq.com> Co-authored-by: jiangshantao <jiangshantao-dbg@qq.com>
…edf deadline (envoyproxy#19712) * fix: slow start config add min_weight_percent field to avoid too big edf deadline Signed-off-by: jiangshantao <jiangshantao-dbg@qq.com>
PR to fix #19526
Commit Message:
cluster SlowStartConfig add min_weight_percent field to avoid too big edf deadline. set default value 0.1.
Additional Description:
Risk Level: Low
Testing: Done
Docs Changes: Done
Release Notes:Done
Fixes #19526